package me.muci.singletonPattern;

/**
 * ClassName: SingletonClass1 <br/>
 * Description:饿汉式加载，但是 StaticInnerClassSingleton 类加载时，instance不一定被初始化，只有显示调用getInstance()时才会加载SingletonHolder，然后实例化instance<br/>
 * date: 2021/8/5 9:26<br/>
 *
 * @author muci<br />
 * @description
 * @since JDK 1.8
 */
public class StaticInnerClassSingleton {

    private static class SingletonHolder{
        private static final StaticInnerClassSingleton instance = new StaticInnerClassSingleton();
    }

    private StaticInnerClassSingleton(){

    }

    public static final StaticInnerClassSingleton getInstance(){
        return SingletonHolder.instance;
    }
}
